<template>

    <el-dialog
        v-model="props.dialogVisible"
        title="分佣日志"
        width="70%"
        @open="open"
        :before-close="close"
    >
        <el-table :data="tableData" border style="width: 100% ;height:500px">
            <el-table-column prop="order_sn" label="订单号" width="300"/>
            <el-table-column prop="scale" label="抽成(%)" width="180"/>
            <el-table-column prop="money" label="金额" width="180"/>
            <el-table-column prop="create_time" label="分成时间"/>
        </el-table>
        <el-pagination style="margin-top: 10px" background layout="prev, pager, next" :total="total"/>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="close()">关闭</el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script lang="ts" setup>
import {ref} from 'vue'
import {giveaway} from "/@/api/backend/extend";
import Template from "/@/lang/backend/en/sms/template";

const props = defineProps({
    dialogVisible: {
        type: Boolean,
        default: false
    },
    row: {
        type: Object,
        default: {}
    },
})

const tableData = ref();
const total = ref();
const open = () => {
    giveaway({user_id: props.row.id}).then(res => {
        tableData.value = res.data.list
        total.value = res.data.total
    })
}

const emit = defineEmits(['close'])
const close = () => {
    emit('close')
}

</script>

